package io.xccit.service.impl;

import io.xccit.service.CheckoutService;
import io.xccit.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Xccit
 * @Date 2023-02-01
 * @Description
 */
@Service
public class CheckoutServiceImpl implements CheckoutService {
    @Autowired
    private IBookService bookService;
    @Transactional
    @Override
    public void checkout(Integer readerId, Integer[] bookIDs) {
        for (Integer bookID : bookIDs) {
            bookService.buyBook(readerId,bookID);
        }
    }
}
